#include "GameCreditsState.h"

GameCreditsState::GameCreditsState(BeanieCore* a_core, bool a_renew)
{
	m_core = a_core;

	m_name = "GameCredits";
	m_selfId = GAMECREDIT;
	m_swapId = GAMECREDIT;
	m_completed = false;
	m_renew = a_renew;
}

void GameCreditsState::init()
{
	credits=0;
	//GameButton inherits from GameTexture so init() calls are the same
	m_credits1.initTexture(m_core,BG_CREDITS1,
		TEX_TOPLEFT,V2D_ZERO,V2D_DOUBLE,0.0f,true);
	m_credits2.initTexture(m_core,BG_CREDITS2,
		TEX_TOPLEFT,V2D_ZERO,V2D_DOUBLE,0.0f,true);
	m_credits1.onClick([&](){credits=1;});
	m_credits2.onClick([&](){credits=0;m_swapId=GAMEMENU;m_completed=true;});
}

void GameCreditsState::release()
{

}

void GameCreditsState::input()
{
	m_credits1.input();
	m_credits2.input();
}

void GameCreditsState::update()
{
	m_credits1.update();
	m_credits2.update();
}

void GameCreditsState::draw()
{
	switch(credits){
	case 0:
		m_credits1.draw();
		break;
	case 1:
		m_credits2.draw();
		break;
	}
}

void GameCreditsState::preLoop()
{

}

void GameCreditsState::postLoop()
{

}